package com.ec.auth;

import com.ec.common.constant.AppConstant;
import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.scheduling.annotation.EnableAsync;

/**
 * @description:
 * @author: Eric Lee
 * @time: 2021/5/20 18:53
 */
@EnableFeignClients(AppConstant.BASE_PACKAGES)
@EnableHystrix
@EnableAsync
@SpringBootApplication
@EnableDiscoveryClient
@EnableEncryptableProperties
public class AuthApplication {
    public static void main(String[] args) {
        try {
            SpringApplication.run(AuthApplication.class, args);
        } catch (Throwable e) {
            e.printStackTrace();
        }
    }

    /**
     * 设置@Value注解取值不到忽略（不报错）
     *
     * @return
     */
    @Bean
    public static PropertySourcesPlaceholderConfigurer placeholderConfigurer() {
        PropertySourcesPlaceholderConfigurer c = new PropertySourcesPlaceholderConfigurer();
        c.setIgnoreUnresolvablePlaceholders(true);
        return c;
    }
}
